1. Function Implementations

1.1 function 1: ReadFile and attach packages

1.2. function 2: Wave

1.3. function 3: fourier_smooth

1.4. function 4: fPCA.nodes

1.5. function 5: node.scaler

1.6. function 6: row.check

1.7 function pc.df

it’s to put variance on 1st and 2nd Principle Components into dataframe. It is the same.

1.8 function nodes.compare

main script

1. Compare same node across different patients from PD-placebo group

pd_placebo <- c(1,4,6,10,14,15,18,20,22,23,31,46,47,50,56,60,61,64,65,80,81,91,97)
for (i in c(1:32)){
  ### put node 1 from PD-placebo group together
  node1=nodes.compare(pd_placebo, node_number=i)
  d <- melt(data = node1, id.vars = c("index"), measure.vars = paste('patient', pd_placebo, sep = ""))
  print(ggplot(d, aes(x = index, y = value)) + 
          geom_line(aes(color = variable, linetype = variable)) + ggtitle(paste("PD-placebo, Node,",i)))
  ### fpca on the node dataframe
  rotpcalist = fPCA.nodes(as.matrix(node1[,1:23]), k=11, nharm=2, plt=1)
  }